<!--
* description: 历史查询
* author: wangmaolin
* createdDate: 2021
* logs:
-->
<template>
  <section class="history">
    <el-dialog
      v-dialogDrag
      :close-on-click-modal="true"
      title="历史查询"
      :append-to-body="true"
      :visible="popupsVisible"
      width="70%"
      @close="closeEdit"
      @opened="open"
    >
      <dialogHeader
        slot="title"
        title="维修历史查询"
        :style-type="$store.state.app.dialogType"
      />
      <div class="filter-container filter-params">
        <!-- 单表格模版页面 -->
        <one-table-template
          ref="multipleTable"
          :dynamic-api-config="apiConfig"
          :dynamic-buttons="dynamicButtons"
          :dynamic-components="tableComponents"
          :dynamic-table-cols="dynamicTableCols"
          :dynamic-form-fields="formField"
          :dynamic-table-defult-height="300"
          :dynamic-is-show-more-btn="true"
          :dynamic-is-show-select="false"
          :dynamic-api-style="'restful'"
          :dynamic-page-size="10"
          :callback-obj="callbackObj"
        >
          <!-- <template #repairOrderCode="{col, row}">
            <el-link
              @click="getInfo(row)"
            >{{ row.repairOrderCode }}</el-link>
          </template> -->
        </one-table-template>
      </div>
    </el-dialog>
    <!-- <sysorder-details-dia
      :popups-visible.sync="open"
      :row-data="detailData"
    /> -->
  </section>
</template>
<script>

// import { formMixins } from '@/components/mixins/formMixins'
import { oneTableWithViewTemplateMixins } from '@/components/mixins/oneTableWithViewTemplateMixins'
import OneTableTemplate from '@/components/templates/oneTable'
import sysorderDetailsDia from '@/views/se/maintenanceManagement/maintenanceOrderSearch/sysorderDetailsDia'

export default {
  name: 'Historyquery',
  components: {
    OneTableTemplate,
    sysorderDetailsDia,
    dialogHeader: () => import('@/components/dialogHeader') // 弹窗标题
  },
  // 组件混入对象
  mixins: [oneTableWithViewTemplateMixins],
  props: {
    popupsVisible: { type: Boolean, default: false },
    rowData: { type: Object, default: () => ({}) }
  },
  data() {
    return {
      // open: false,
      detailData: {},
      // 保存API配置对象
      apiConfig: {
        APIUrl: '/mp/e3sh/aftersale/maintainceWorkService/queryData.do',
        ServiceCode: 'querydata'
      },
      // 动态组件-按钮
      dynamicButtons: [],
      tableComponents: [
        {
          compKey: 'key0',
          labelName: '车牌号：',
          codeField: 'carLicense',
          component: () => import('@/components/org/commonInput'),
          disabled: true,
          isMust: true
        },
        {
          compKey: 'key1',
          labelName: 'VIN码：',
          codeField: 'vin',
          component: () => import('@/components/org/commonInput'),
          disabled: true,
          isMust: true
        },
        {
          compKey: 'key2',
          labelName: '车主姓名：',
          codeField: 'custName',
          component: () => import('@/components/org/commonInput'),
          disabled: true,
          isMust: true
        }
      ],
      dynamicTableCols: [
        {
          prop: 'repairOrderCode',
          label: '工单号',
          minWidth: 180,
          fixed: true
        },
        {
          prop: 'repairOrderStatusName',
          label: '维修状态',
          
          fixed: true
        },
        {
          prop: 'releaseId',
          label: '主键ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'controlId',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'dlrCode',
          label: '门店编码'
        },
        {
          prop: 'dlrShortName',
          label: '门店名称'
        },
        {
          prop: 'repairTime',
          label: '到店时间'
        },
        {
          prop: 'deliveryDate',
          label: '预计交车时间'
        },
        {
          prop: 'repairMan',
          label: '送修人'
        },
        {
          prop: 'repairTel',
          label: '送修人电话'
        },
        {
          prop: 'empName',
          label: '服务顾问'
        },
        {
          prop: 'mileage',
          label: '行驶里程'
        }
      ],
      callbackObj: {

      },
      // 表单数据（无需赋值，由混入对象赋值）
      formField: {
        vin: '',
        carLicense: '',
        custName: '',
        repairOrderCode: ''
      }
      // initFormField: null,
      // genCodeFiled: () => {}
    }
  },
  watch: {
  },
  created() {
  },
  mounted() {
  },
  methods: {
    open() {
      const that = this
      this.formField.carLicense = this.rowData.carLicense
      this.formField.custName = this.rowData.custName
      this.formField.vin = this.rowData.vin
      this.$nextTick(() => {
        that.queryTable(1)
      })
    },

    // 关闭弹窗
    closeEdit() {
      this.$emit('close')
      this.popupsVisible = false
      this.$emit('update:popupsVisible', false)
    }
    // getInfo(row) {
    //   this.open = true
    //   this.detailData = row
    // },
    // changeCode(code, text, codeField, comType) {
    //   const d = parseInt(comType)
    //   this.orderList[d][codeField] = code
    // },
    // handleClose() {
    //   this.$emit('update:popupsVisible', false)
    // },
    // // 生成formField
    // genUtil: (array) => (attr1 = 'codeField', attr2 = 'textField') => array.reduce((p, c) => {
    //   p[c[attr1]] = ''
    //   // eslint-disable-next-line no-prototype-builtins
    //   c.hasOwnProperty(attr2) ? p[c[attr2]] = '' : ''
    //   return p
    // }, {}),
    // closePopups() {
    //   for (const attr in this.formField) {
    //     this.formField[attr] = ''
    //   }
    // },
    // reset() {
    //   for (const attr in this.formField) {
    //     this.formField[attr] = ''
    //   }
    // }
  }
}
</script>
<style scoped>
</style>
